package com.zsr.controller;

import com.zsr.pojo.ToEmail;
import com.zsr.utils.APIResponse;
import com.zsr.utils.EmailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zsr
 * @desc
 * @date 2021/6/6 16:56
 */
@Controller
public class EmailController {

    @Autowired
    EmailUtil emailUtil;

    @GetMapping({"/","index","index.html"})
    public String index(){
        return "index";
    }

    @PostMapping("/test")
    public APIResponse test1(ToEmail toEmail){
        APIResponse apiResponse = emailUtil.commonEmail(toEmail);
        return apiResponse;
    }
}
